package com.nd.qa.shareplate.common;


import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;

import com.nd.qa.shareplate.script.realmonkey.RealTestSuites;


/**
 * 获取配置文件信息config.properties
 * @author wuqiaomin
 *
 */
public final class PropertiesManager {
	
	public static String debugKeyStorePath;
	public static String debugAlias;
	public static String predebugKeyStorePath;
	public static String predebugAlias;
	public static String androidJarPath;
	public static String javaTarget;
	public static String reportPath;
	public static String rootPath;
	public static String localApkPath;
	public static String localDocPath;
	

	static {
		Properties prop = new Properties();
		try {
//			rootPath = System.getProperty("user.dir");
			String path = RealTestSuites.class.getResource("/").getPath();
			rootPath = (path.replace("/build/classes", "").replace("%20"," ")).replaceFirst("/", "");
			InputStream in = new FileInputStream(new File(
					rootPath + "\\properties\\configuration.properties"));
			prop.load(in);
			debugKeyStorePath = String.format("\"%s\"", prop.getProperty("debugKeyStorePath"));
			debugAlias = String.format("\"%s\"", prop.getProperty("debugAlias"));
			predebugKeyStorePath = String.format("\"%s\"", prop.getProperty("predebugKeyStorePath"));
			predebugAlias = String.format("\"%s\"", prop.getProperty("predebugAlias"));
			androidJarPath = String.format("\"%s\"", prop.getProperty("androidJarPath"));
			javaTarget = String.format("\"%s\"", prop.getProperty("javaTarget"));
			reportPath = prop.getProperty("reportPath");
			localApkPath = prop.getProperty("localApkPath");
			localDocPath = prop.getProperty("localDocPath");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}	

	private PropertiesManager() {
	}
}
